//
// Carl Beyer   cbeyer1
// <class #>   <class title>
// <assignment>
// 11/25/2009
//
// stratego.cpp
// <file description>
//

#include <iostream>
#include <ncurses.h>
#include "game.h"

int main(void)
{
	int color, diff, winner, again, nrows, ncols;
	char ready;
	Game myGame;
	WINDOW* mainWindow;
	// initialize ncurses
	initscr();
	cbreak();
	noecho();
	// hide the cursor
	curs_set(0);
	// make sure the window is big enough
	getmaxyx(stdscr, nrows, ncols);
	ready = ' ';
	while(nrows < 48 || ncols < 102 || ready != ' ') {
		clear();
		mvprintw(1, 1, "Please resize the window to at least 48x102 and then press spacebar to continue...");
		refresh();
		ready = getch();
		getmaxyx(stdscr, nrows, ncols);
	}
	clear();

	// enable mouse input
	keypad(stdscr,TRUE);
	mousemask(ALL_MOUSE_EVENTS,NULL);

	// set colors
	start_color();
	init_pair(1, COLOR_BLACK, COLOR_RED);
	init_pair(2, COLOR_WHITE, COLOR_RED);
	init_pair(3, COLOR_BLACK, COLOR_BLUE);
	init_pair(4, COLOR_WHITE, COLOR_BLUE);
	init_pair(5, COLOR_BLACK, COLOR_GREEN);
	init_pair(6, COLOR_WHITE, COLOR_BLUE);
	init_pair(7, COLOR_WHITE, COLOR_BLACK);
	init_pair(8, COLOR_BLACK, COLOR_WHITE);

	// start game
	myGame.newGame();

	// end ncurses and quit (this point should never be reached, because the program does
	// not end until the Quit button is pressed, which calls exit() and quits immediately)
	endwin();
	return 0;
}

